/**
 * 
 */
package util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

/**
 * @author puneet
 * 
 */
public class HDFSFileUtil {
	public static List<String> readFileAsLineList(String path, FileSystem fs) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(fs.open(new Path(path))));
			String s = null;
			List<String> returnList = new ArrayList<String>();
			while((s=br.readLine()) != null) {
				returnList.add(s);
			}
			return returnList;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
